﻿
MyComponents.SaveButton = null;
MyComponents.NewButton = null;
MyComponents.EditButton = null;
MyComponents.DeleteInFormButton = null;
MyComponents.DeleteInGridButton = null;
MyComponents.ExitButton = null;

MyComponents.Save = function(formName) {

};

MyComponents.New = function(formName) {

};

MyComponents.Edit = function(formName) {

};

MyComponents.DeleteInForm = function(formName) {

};

MyComponents.DeleteInGrid = function(formName) {

};

function IndexRibbonDefaultInit(s, e) {
    MyComponents.NewButton = s.GetItemByName("btnNew");
    MyComponents.EditButton = s.GetItemByName("btnEdit");
    MyComponents.ExportPdfButton = s.GetItemByName("btnExportPdf");
    MyComponents.ExportCsvButton = s.GetItemByName("btnExportCsv");
    MyComponents.ExportExcelButton = s.GetItemByName("btnExportExcel");

    if (MyComponents.NewButton != null && MyComponents.NewButton != 'undefined') {
        $('#'+ MyComponents.NewButton.id).click(function(s,e) {
            if (MyComponents.NewButton.GetEnabled() == true) {
                if (window[MyComponents.Settings.DialogName] == null || window[MyComponents.Settings.DialogName] == 'undefined') {
                    //$.ajax({                        
                    //    url: MyComponents.Settings.UrlLoadPopup,
                    //    method: 'POST'
                    //}).success(function(data) {
                    //    $("#popups").append(data);
                    //}).error(function(errorCode) {
                        
                    //});
                }
                if (window[MyComponents.Settings.DialogName] != null && window[MyComponents.Settings.DialogName] != 'undefined') {
                    
                    window[MyComponents.Settings.DialogName].Show();
                    

                }
            }
        });
    }
    if (MyComponents.EditButton != null && MyComponents.NewButton != 'undefined') {
        $('#' + MyComponents.EditButton.id).click(function (s, e) {
            if (MyComponents.EditButton.GetEnabled() == true) {
                $(window.document.location).attr('href', MyComponents.Settings.UrlGet);
            }
        });
    }
    
}